﻿//******************************************************************************************************
//  SaveChangesForm.cs - Gbtc
//
//  Copyright © 2010, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://www.opensource.org/licenses/eclipse-1.0.php
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  07/30/2010 - Stephen C. Wills
//       Generated original version of source code.
//
//******************************************************************************************************

using System;
using System.Windows.Forms;

namespace PdcTestBench
{
    public partial class SaveChangesForm : Form
    {

        #region [ Members ]

        // Fields

        private SaveFileDialog m_saveAsFileDialog;
        private string m_filePath;

        #endregion

        #region [ Constructors ]

        /// <summary>
        /// Creates a new instance of the <see cref="SaveChangesForm"/> class.
        /// </summary>
        /// <param name="saveAsFileDialog">The <see cref="SaveFileDialog"/> used when the user clicks the "Save As..." button.</param>
        public SaveChangesForm(SaveFileDialog saveAsFileDialog)
        {
            InitializeComponent();
            m_saveAsFileDialog = saveAsFileDialog;
        }

        #endregion

        #region [ Properties ]

        /// <summary>
        /// The file path chosen by the user when they select the "Save As..." button.
        /// </summary>
        public string FilePath
        {
            get
            {
                return m_filePath;
            }
        }

        #endregion

        #region [ Methods ]

        // Called when the user clicks the button labeled "Save As..."
        private void saveAsButton_Click(object sender, EventArgs e)
        {
            DialogResult result = m_saveAsFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                m_filePath = m_saveAsFileDialog.FileName;
                DialogResult = DialogResult.OK;
            }
        }

        #endregion
    }
}
